﻿<%@ Page Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true" CodeFile="ShoppingCart.aspx.cs" Inherits="ShoppingCart" Title="Beta Books | Shopping Cart" %>
<%@ MasterType virtualPath="~/MasterPage.master"%>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <span class="heading">Shopping Cart</span>
    <table class="contentTable">
        <tr>
            <td style="height:22px;width:20px;background-image:url('images/ictl.png');background-position: top;background-repeat:no-repeat"></td>
            <td style="background-image:url('images/bg.png');"></td>
            <td style="height:22px;width:20px;background-image:url('images/ictr.png');background-position: top;background-repeat:no-repeat"></td>
        </tr>
        <tr class="contentbg">
            <td></td>
            <td>
                <asp:GridView ID="cartGridView" runat="server" AutoGenerateColumns="False" 
                    Width="780px" onrowcancelingedit="cartGridView_RowCancelingEdit"
                    onrowdeleting="cartGridView_RowDeleting" onrowediting="cartGridView_RowEditing" 
                    onrowupdating="cartGridView_RowUpdating" DataKeyNames="ISBN" 
                    EmptyDataText="Shopping cart is empty" CssClass="table">
                    <Columns>
                        <asp:BoundField DataField="Title" HeaderText="Title" ReadOnly="True" />
                        <asp:BoundField DataField="Price" DataFormatString="{0:c}" HeaderText="Price" 
                            ReadOnly="True">
                            <ItemStyle HorizontalAlign="Right" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Quantity" ItemStyle-Width="110px">
                            <ItemTemplate>
                                <asp:Label ID="quantityLabel" runat="server" Text='<%# Bind("Quantity") %>'></asp:Label>
                                &nbsp;
                                <asp:Button ID="editButton" runat="server" CommandName="Edit"
                                    Text="Edit"  CssClass="button"/>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="quantityTextBox" runat="server" Text='<%# Bind("Quantity") %>' 
                                    Width="25px"></asp:TextBox>
                                <asp:RangeValidator ID="RangeValidator1" runat="server" 
                                    ControlToValidate="quantityTextBox" ErrorMessage="Quantity must be greater than 0 " 
                                    MinimumValue="1" MaximumValue="100" Width="10px" SetFocusOnError="True" 
                                    Display="None" Type="Integer"></asp:RangeValidator>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Field must contain a value." Display="None" ControlToValidate="quantityTextBox" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                <br />
                                <asp:Button ID="updateButton" runat="server" CommandName="Update" CssClass="button" 
                                    Text="Update" Width="50px" />
                                <asp:Button ID="cancelButton" runat="server" CommandName="Cancel" 
                                    Text="Cancel" Width="49px" CausesValidation="False"  CssClass="button"/>
                            </EditItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:CommandField ButtonType="Button" ShowDeleteButton="True" 
                            DeleteText="Remove" ShowCancelButton="False" 
                            ControlStyle-CssClass="button">
<ControlStyle CssClass="button"></ControlStyle>
                        </asp:CommandField>
                    </Columns>
                    <HeaderStyle BackColor="#9F89B6" />
                    <AlternatingRowStyle BackColor="Silver" />
                </asp:GridView>
                <asp:ValidationSummary ID="Errors" runat="server" ShowMessageBox="True" 
                    DisplayMode="SingleParagraph" ShowSummary="False" />
                <br />
                <div>
                    <asp:Label ID="totalLabelLabel" runat="server" Text="Shopping Cart Total: "></asp:Label>
                    <asp:Label ID="totalLabel" runat="server" Text="$0.00"></asp:Label>
                    <br />
                    <br />
                    <asp:Button ID="continueButton" runat="server" 
                        onclick="continueButton_Click" style="margin-top: 3px" 
                        Text="Continue Shopping"  CssClass="button"/>
&nbsp;<asp:Button ID="checkoutButton" runat="server" onclick="checkoutButton_Click" 
                        Text="Checkout"  CssClass="button"/>
                </div>
             </td>
            <td></td>
        </tr>
        <tr>
            <td style="height:22px;width:20px;background-image:url('images/icbl.png');background-position: top;background-repeat:no-repeat"></td>
            <td style="background-image:url('images/bg.png');"></td>
            <td style="height:22px;width:20px;background-image:url('images/icbr.png');background-position: top;background-repeat:no-repeat"></td>
        </tr>
    </table>
</asp:Content>

